//
//  libDefine.h
//  lib
//

#import <UIKit/UIKit.h>



#ifdef __DEBUG__
	#define DebLog(args...)		NSLog(@"%s:%@", __FUNCTION__, [NSString stringWithFormat:args])
#else
	#define DebLog(args...)
#endif	//__DEBUG__


#define SAFE_RELEASE(p)			{ if (p) { [(p) release]; (p) = nil;  } }
#define SAFE_FREE(p)			{ if (p) { free(p);       (p) = NULL; } }




#define		RAD_TO_DEG		57.29577957f	
#define		DEG_TO_RAD		0.017453293f	
#define		DegreeToRadian(degree)	((CGFloat)(M_PI * (degree) / 180.0f))


#define		TEXT_SPACE		@""

#define		SECTION_SPACE	@" "

#define		TIME_INIT		0.0f			

#define DEVICE_WILLROTATE_NOTIFICATION	(@"DeviceWillRotateNotification")
#define DEVICE_DIDROTATE_NOTIFICATION	(@"DeviceDidRotateNotification")



extern BOOL IS_FIRST_LOAD;
extern BOOL SHOULD_RELOAD_MAIN;
extern BOOL SHOULD_RELOAD_NEWS;




extern BOOL IS_IPAD;

extern BOOL IS_IPHONE4;

extern BOOL IS_PAPERBACK;


extern float DISPLAY_FULL_WIDTH;
extern float DISPLAY_FULL_HEIGHT;

#define DISPLAY_HW_SIZE_RATE	(DISPLAY_FULL_HEIGHT / DISPLAY_FULL_WIDTH)	


#define DISPLAY_IPAD_SIZE_RATE_WIDTH	(768.0f / 320.0f)
#define DISPLAY_IPAD_SIZE_RATE_HEIGHT	(1024.0f/ 480.0f)

#define CLOCK_HEIGHT			20.0f
#define NAVIBAR_HEIGHT			44.0f
#define TOOLBAR_HEIGHT			50.0f
#define TOOLBAR_HEIGHT_LAND_IPHONE		30.0f
#define TABBAR_HEIGHT			49.0f
#define DISPLAY_WIDTH			DISPLAY_FULL_WIDTH
#define DISPLAY_HEIGHT			(DISPLAY_FULL_HEIGHT - CLOCK_HEIGHT)
#define DISPLAY_CENTER_X		(DISPLAY_WIDTH / 2.0f)
#define DISPLAY_CENTER_Y		(DISPLAY_HEIGHT / 2.0f)

extern  CGRect			DISPLAY_RECT_PORT;
extern CGRect			DISPLAY_RECT_LAND;

extern CGRect			TOOLBAR_RECT_PORT;
extern CGRect			TOOLBAR_RECT_LAND;
											

extern CGRect			TABBAR_RECT_PORT;
extern CGRect			TABBAR_RECT_LAND;



#define VIEW_AUTORESIZE_POS_PORT		( UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin )
#define VIEW_AUTORESIZE_POS_LAND		( UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin )
#define VIEW_AUTORESIZE_POS_BR		( UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin )
#define VIEW_AUTORESIZE_POS_TL		( UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin )

#define VIEW_AUTORESIZE_POS			( VIEW_AUTORESIZE_POS_PORT | VIEW_AUTORESIZE_POS_LAND )

#define VIEW_AUTORESIZE_SIZE		( UIViewAutoresizingFlexibleWidth \
									| UIViewAutoresizingFlexibleHeight )

#define VIEW_AUTORESIZE_ALL			( VIEW_AUTORESIZE_POS | VIEW_AUTORESIZE_SIZE )

#define VIEW_AUTORESIZE_BAR			( UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth )
